'''
The Client User Interface for the scanner workflow (Winter Intensives Lab 6)

'''

# these next few lines import some of the WMP functions we will
# use in this file.
from frontend.roleApplication import RoleApplication
from frontend.form import Type

class ClientApplication(RoleApplication):
    '''
    The ClientApplication "class" is a collection of the "methods" (functions) that 
    define the elements of the order taker application.  
    
    An application will always include the method __init__ and at least one
    method to define a form that the user of this application will use.
    '''

    def __init__(self):
        '''
        Declare this application to be part of a given work flow and specify its role in that workflow.
        '''
        # Declare this application to be part of a given workflow, and responsible for a given role:
        # !!! Modify the following to use the actual work flow name and role name you need...
        super(ClientApplication, self).__init__("storagegalore", "Client") 
        # Declare any tasks that this role is able to perform:
        # !!! Modify to use actual name for this task...
        self.register_source_step("SendDocument", self.send_document_form_creator)
        self.register_sink_step("ViewDocument", self.view_document_form_creator, name_fields=["sequence", "FirstName", "LastName", "DocumentNumber"]) 

    def send_document_form_creator(self, stepname, form):
        '''
        This method does the actual work of building the user interface.
        '''
        # !!! improve this text...
        form.add_static_label('Identify Documents to be Scanned:')
        form.add_field(Type.SHORTSTRING, "FirstName", labeltext="First Name", initial="default")
        form.add_field(Type.SHORTSTRING, "lastName", labeltext="Last Name", initial="default")
        form.add_field(Type.SHORTSTRING, "DocumentNumber", labeltext="Document Number", initial="default")
        
    def view_document_form_creator(self, stepname, form):
        '''
        This method does the actual work of building the user interface.
        '''
        # !!! improve this text...
        form.add_static_label('Select Documents to View')
        form.add_task_label(fields=["FirstName", "LastName", "DocumentNumber"])

if __name__ == '__main__':
    #starts up the OrderTakerApplication:
    app = ClientApplication()
    #Start interacting with the user:
    app.MainLoop()